package com.fancy.social.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fancy.imasclient.dto.FollowInfoDTO;
import com.fancy.social.entity.UserFollow;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface UserFollowMapper extends BaseMapper<UserFollow> {

    Long countFollowing(@Param("userId") Long userId);
    Long countFollowers(@Param("userId") Long userId, @Param("targetType") Integer targetType);

    // 新增countByCondition方法
    Long countByCondition(@Param("ew") QueryWrapper<UserFollow> wrapper);
    /**
     * 分页查询关注列表
     */
    Page<FollowInfoDTO> selectFollowingPage(Page<FollowInfoDTO> page, @Param("userId") Long userId);

    /**
     * 分页查询粉丝列表
     */
    Page<FollowInfoDTO> selectFollowersPage(Page<FollowInfoDTO> page, @Param("userId") Long userId);
}
